<template>
  <div>
    <section>
      <span>请求次数：</span>
      <el-input v-model="requestNum"></el-input>
    </section>
    <section>
      <span>请求id：</span>
      <el-input v-model="id"></el-input>
    </section>
    <el-button @click="login1">缓存击穿测试</el-button>

    <section class="step-section">
      <span>1、</span>
      <span>核心代码：</span>
      <span>synchronized (CacheBreakdownServiceImpl.class)</span>
    </section>
  </div>
</template>

<script>
import API from '@/api/cacheBreakdown'
export default {
  name: 'cacheBreakdown',
  data() {
    return {
      requestNum: 1,
      id: 1
    }
  },
  methods: {
    login1() {
      for (let index = 0; index < this.requestNum; index++) {
        API.login1(this.id).then(res => {
          this.$message.success(`操作成功！`)
        }).catch(e => {
          this.$message.error(`error:${e.message}`)
        }).finally(() => {

        })
      }

    }
  }
}
</script>

<style lang="less" scoped>
.step-section {
  font-size: 16px;
  font-weight: bold;
}
</style>
